from typing import List

from pydantic import BaseModel, Field


# headers = {
#     'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
#     'Accept-Encoding': 'gzip, deflate',
#     'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
#     'Host': 'kns.cnki.net',
#     'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36'
# }


class ErrModel(BaseModel):
    # 服务端IP
    ip_port: str = ""
    # 客户端ip
    client_ip: str = ""
    # 时间
    write_time: str = ''
    # 错误类型
    err_type: str = ''
    err_msg: str = ''
    # 错误信息
    traceback_str: str = ""
    # 任意字典
    dicts_item: dict = {}
    # 错误来源
    err_source = "client"
    # 任务名,区分属于哪个任务的错误
    task_name: str = ''
    step_name: str = ""


class ServerErrModel(BaseModel):
    # ip地址
    ip_port: str = ""
    # 客户端ip
    client_ip: str = ""
    # 错误时间
    write_time: str = ""
    # 请求的url
    request_url: str = ""
    # 请求的body
    request_body: str = ""
    # # 请求参数
    # request_params: str = ""
    # 错误类型
    err_type: str = ""
    # 错误消息
    err_msg: str = ""
    # 错误日志
    traceback_str: str = ""
    # 错误来源
    err_source = "server"
    # 错误标识位
    stat = 0
    test: str = ""



class DataErrModel(BaseModel):
    # IP
    ip: str = ''
    # 时间
    write_time: str = ''
    # 请求的api url
    request_url: str = ''
    # 请求时发送的参数
    request_body: str = ''
    # 错误类型
    err_type: str = ''
    # 错误信息
    traceback_str: str = ''
    # 任意字典
    dicts_item: dict = {}
    # 结果信息
    result_info: str = ''
    # 错误来源
    err_source = ""
    # 字库信息
    task_info: dict = {}


class DataUserErrModel(BaseModel):
    # IP
    ip: str = ''
    # 时间
    write_time: str = ''
    # 错误类型
    err_type: str = ''
    # 报错文件位置
    file_code_line: str = ''
    # 任意字典
    dicts_item: dict = {}
    # 子库名
    task_info: str = ''
